/*****************************************************************************
 * Copyright (c) 2010 -, Anders All rights reserved
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  Contact: Anders Uddenberg (anders.uddenberg@gmail.com)
 * 
 *
 ****************************************************************************/
package org.easypr.organizer.client.view;

import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import org.easypr.organizer.client.presenter.MenuPresenter;
import org.easypr.organizer.shared.MyUser;

// TODO: Auto-generated Javadoc
/**
 * The Class MenuView.
 */
public class MenuView extends Composite implements MenuPresenter.Display {

	/** The container. */
	FlowPanel container;
	
	/** The search input. */
	TextBox searchInput;
	
	/** The search button. */
	Button searchButton;
	
	/** The logout link. */
	Anchor logoutLink;

	/**
	 * Instantiates a new menu view.
	 */
	public MenuView() {
		container = new FlowPanel();
		initWidget(container);
		
		searchInput = new TextBox();
		searchButton = new Button("Search");
		logoutLink = new Anchor("Logout");
	}
	
	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.MenuPresenter.Display#getSearchInput()
	 */
	public TextBox getSearchInput() {
		return this.searchInput;
	}
	
	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.MenuPresenter.Display#getSearchButton()
	 */
	public Button getSearchButton() {
		return this.searchButton;
	}

	/**
	 * Gets the logout link.
	 *
	 * @return the logout link
	 */
	public Anchor getLogoutLink() {
		return this.logoutLink;
	}
	
	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.MenuPresenter.Display#setData(org.easypr.organizer.shared.MyUser)
	 */
	public void setData(MyUser user) {
		
		container.clear();

		//container.setWidth("100%");
		container.addStyleName("menu");
		
		Hyperlink create = new Hyperlink("Create", "create");
		create.addStyleName("create-new");
		container.add(create);
		
		Hyperlink link = new Hyperlink("Home", "dashboard");
		link.addStyleName("menulink");
		container.add(link);
		
		link = new Hyperlink("Contacts", "browse");
		link.addStyleName("menulink");
		container.add(link);
		
		link = new Hyperlink("Friends", "friends");
		link.addStyleName("menulink");
		container.add(link);
		
		/*
		logoutLink.addStyleName("menulink");
		container.add(logoutLink);
		*/
		
	}

	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.MenuPresenter.Display#asWidget()
	 */
	@Override
	public Widget asWidget() {
		return this;
	}
}
